cmake_minimum_required(VERSION 3.10)

cmake_policy(SET CMP0074 NEW)
find_package(Boost COMPONENTS date_time)

include_directories( ${Boost_INCLUDE_DIRS})

aux_source_directory(src SRC)
aux_source_directory(src/model SRC)
aux_source_directory(src/signals SRC)

add_library(scada SHARED ${SRC}) 

DB_SELECT(scada)

target_link_libraries(scada options ${Boost_LIBRARIES})

set_target_properties(scada PROPERTIES WIN32_MANIFEST "NO")

find_package(CxxTest)
if(CXXTEST_FOUND)
    include_directories(${CXXTEST_INCLUDE_DIR})
    enable_testing()
    CXXTEST_ADD_TEST(test_scada test_scada.cpp
    	${CMAKE_CURRENT_SOURCE_DIR}/test/signals/status_mgr.hxx 
		${CMAKE_CURRENT_SOURCE_DIR}/test/model/status_info.hxx 
		${CMAKE_CURRENT_SOURCE_DIR}/test/model/model_mgr.hxx 
    	${CMAKE_CURRENT_SOURCE_DIR}/test/boost_lock.hxx 
		)
	target_link_libraries(test_scada scada)
	set_target_properties(test_scada PROPERTIES WIN32_MANIFEST "NO")
endif()

install(TARGETS scada LIBRARY)